<?php
require_once("AbstractPager.php");

class ProductPager extends AbstractPager {
	
	public function renderData($data, $pagor){
		
		echo "<table cellspacing='2' cellpadding='2'>";
			echo "<theader>TABULKA PRODUKTU</theader>";
			
			for($i = 0; $i<$pagor; $i++){
			echo "<tr>";
				echo "<td>";
					echo $data[$i]->getProductId();
				echo "</td>";
				
				echo "<td>";
					echo $data[$i]->getProductName();
				echo "</td>";
				
				echo "<td>";
					echo $data[$i]->getProductPrice();
				echo "</td>";
				
				echo "<td>";
					echo "<form action='cart.php' method='post'>";
   						echo "<input type='submit' value='Add to Cart' />";
   						echo "<input type='hidden' name='add' value='".$data[$i]->getProductId()."'>";
   						
   						$nurl = Utils::rewriteParameters();
   						
   						echo "<input type='hidden' name='ref' value='index.php".$nurl."'>";
					echo "</form>";
				echo "</td>";
				
				
			echo "</tr>";
			}
		echo "</table>";
		
	}
	
}

?>
